package com.xieyingwangluo.yxpart.mapper;

import com.xieyingwangluo.yxpart.entity.UserInfoModel;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public interface UserInfoMapper {
    /**
     * 新增保存
     *
     * @return
     */
    //@CacheEvict(value="d_user",allEntries = true)
    int add(UserInfoModel userInfo);

    /**
     * 根据id获取用户信息
     *
     * @param noid
     * @return
     */
    //@Cacheable(value="d_demo",key="'UserMapper_getById_'+#noid")
    UserInfoModel getById(@Param("noid") String noid);

    //个人评价：
    @Select("select info from userinfo where user_id=#{noid}")
    UserInfoModel selInfo(@Param("noid") String noid);

    //显示：用户信息编号（noid）
    @Select("select * from userinfo where user_id=#{noid}")
    UserInfoModel selO(@Param("noid") String noid);

    //修改状态：用户信息编号(userinfo_id)，状态(state)
    @Update("update userinfo set state=#{state} where noid=#{noid}")
    int updS(@Param("noid") String noid, @Param("state") int state);

    //查询用户信息列表
    List<UserInfoModel> selA(UserInfoModel userInfoModel);

    //更新用户信息
    int upd(UserInfoModel userInfoModel);

    //根据用户编号查询用户详情信息
    UserInfoModel getByUserId(@Param("user_id") String user_id);
}
